﻿using MediatR;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using MyMES.Domain.zyy;
using MyMES.Error;

using MyMES.Domain.zyy;
using MyMES.Writer.API.Application.Commends.pressions;


namespace MyMES.Writer.API.Controllers.Pressionsss
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class PressionController : ControllerBase
    {
        private readonly IMediator med;

        public PressionController(IMediator med)
        {
            this.med = med;
        }
        [HttpPost]
        public async Task<APIResult<Pression>> AddPression(AddPressionCommand request, CancellationToken cancellationToken)
        {
            return await med.Send(request, cancellationToken);
        }

        [HttpPut]
        public async Task<APIResult<Pression>> DeletePression(DeleteCommand request, CancellationToken cancellationToken)
        {
            return await med.Send(request, cancellationToken);
        }
        [HttpPut]
        public async Task<APIResult<Pression>> UpdatePression(UpdateCommand request, CancellationToken cancellationToken)
        {

            return await med.Send(request, cancellationToken);
        }
    }
}
